//
//  PreferCollectionViewCell.m
//  Menu
//
//  Created by Lynn-Shin on 15/7/4.
//  Copyright (c) 2015年 lijiangang. All rights reserved.
//

#import "PreferCollectionViewCell.h"

@implementation PreferCollectionViewCell

-(instancetype)initWithFrame:(CGRect)frame{
    
    self = [super initWithFrame:frame];
    if (self) {
        
        [self createSubViews];
    }
    return self;
}

-(void)createSubViews{
    
    self.preferImage = [[UIImageView alloc] initWithFrame:CGRectMake(self.contentView.frame.origin.x, self.contentView.frame.origin.y + 5*HEIGHT, 160*WIDTH, 90*HEIGHT)];
//    self.preferImage.backgroundColor = [UIColor redColor];
    [self addSubview:self.preferImage];
    [self.preferImage release];
    
    self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.contentView.frame.origin.x, self.contentView.frame.origin.y + 95*HEIGHT, 160*WIDTH, 25*HEIGHT)];
//    self.titleLabel.backgroundColor = [UIColor lightGrayColor];
    self.titleLabel.textAlignment = NSTextAlignmentCenter;
    [self addSubview:self.titleLabel];
    [self.titleLabel release];
    
}

-(void)setPreferModel:(PreferModel *)preferModel{
    
    if (_preferModel != preferModel) {
        
        [_preferModel release];
        _preferModel = [preferModel retain];
    }
    
    [self.preferImage sd_setImageWithURL:[NSURL URLWithString:preferModel.imagePathThumbnails] placeholderImage:[UIImage imageNamed:@"zhanwei.png"]];
    self.titleLabel.text = preferModel.name;
    
}

@end
